<template>
	<view>
		<view class="mt-30">
			<view class="plr-36 size-34 bold">
				接单速度
			</view>
			<view class="center mt-30">
				<u-rate :count="5" v-model="receiving" :minCount="1" active-color="#FF9900" inactive-color="#999" :disabled="false"
				 gutter="50" size="60"></u-rate>
			</view>
		</view>
		<view class="mt-30">
			<view class="plr-36 size-34 bold">
				上门速度
			</view>
			<view class="center mt-30">
				<u-rate :count="5" v-model="come" :minCount="1" active-color="#FF9900" inactive-color="#999" :disabled="false"
				 gutter="50" size="60"></u-rate>
			</view>
		</view>
		<view class="mt-30">
			<view class="plr-36 size-34 bold">
				服务态度
			</view>
			<view class="center mt-30">
				<u-rate :count="5" v-model="service" :minCount="1" active-color="#FF9900" inactive-color="#999" :disabled="false"
				 gutter="50" size="60"></u-rate>
			</view>
		</view>
		<view class="plr-36 size-34 bold mt-40">
			服务体验反馈
		</view>
		<view class="mt-20 mlr-36 bl br bt">
			<u-field type="textarea" v-model="message" :clearable="false" :auto-height="false" label-width="0" placeholder="请输入您的反馈情况"></u-field>
		</view>
		<!-- <view class="plr-36 size-34 bold mt-40">
			图片上传
		</view>
		<view class="plr-36 mt-30 img flex1 flex-bottom">
			<image :src="item.img1" class="mr-20 mb-15" mode="" @click="chooseImg" v-for="(item,i) in img" :key="i"></image>
			<view class="gray-2 mb-20">
				{{imgurl?img.length:0}}/3
			</view>
		</view> -->
		<view class="fixed-bottom pb-60">
			<u-button :disabled="!message" type="warning" @click="comment">提交</u-button>
		</view>
	</view>
</template>

<script>
	import {
		upload
	} from '../../common/common.js'
	export default {
		data() {
			return {
				order_id:'',
				receiving: 3,
				come: 3,
				service: 3,
				message:'',
				img: [{
					img1: '../../static/upload.png'
				}], //本地预览路径
				imgurl: '', //上传图片路径
			};
		},
		onLoad(option) {
			this.order_id = option.order_id
		},
		methods: {
			comment() {
				this.$http('/api/order/comment',{
					order_id: this.order_id,
					receiving: this.receiving,
					come: this.come,
					service: this.service,
					evaluate: this.message
				}, "POST").then(()=>{
					uni.showToast({
						title:'评价成功'
					})
					setTimeout(()=>{
						uni.navigateBack({
						})
					},1000)
				})
			},
			chooseImg(){
				upload(3).then(data => {
					console.log(data);
					this.img = data
					let arr=[]
					data.forEach(item=>{
						arr.push(item.img2)
					});
					this.imgurl = arr.join(',')
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	/deep/.u-warning-hover {
		background-color: $yellow !important;
	}
	/deep/.u-btn--warning--disabled {
		background-color: $bg-1 !important;
	}
	.img{
		image{
			width: 164rpx;
			height: 164rpx;
		}
	}
</style>
